import { App } from "vue";

type EventShim = {
  new (...args: any[]): {
    $props: {
      onClick?: (...args: any[]) => void;
    };
  };
};

export type WithInstall<T> = T & {
  install(app: App): void;
} & EventShim;

export function withInstall<T>(option: T, name: string) {
  (option as Record<string, any>).install = (app: App) => {
    app.component(name, option);
  };
  return option as WithInstall<T>;
}
